<?php

namespace App\Http\Controllers;


use App\Models\HouseBroker;
use App\Models\LiveStreaming;
use App\Models\WxUser;
use App\Tools\JsonTools;
use App\Tools\LiveTools;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class LiveController extends Controller
{
    //

    public function myLive(Request $request){

        $id = $request->input('id');
        $live = LiveStreaming::where('id',$id)->first();

        if (!$live){
            return JsonTools::JsonError([],2200,'直播间不存在');
        }
        $user = HouseBroker::where('id',$live['uid'])->first();

        if (!$user){
            return JsonTools::JsonError([],2201,'没有此主播');
        }

        $data = [
          'live_url'=>$live['live_url'],
          'broker_name'=>$user['broker_name'],
          'attention'=>$live['attention'],
          'title'=>$live['direct_broadcasting_title']
        ];

        return view('live',['data'=>$data]);




    }

    public function livePlayback(){

    }
}
